// 第一行表示矩阵的大小
// 第二行表示起点
// 第三行表示终点
//第四行表示湖泊数量
// 第五行及后面, 表示湖泊的坐标

// 准备先用bfs, 确定最短路径,
// 然后使用dfs 确定路线  // 不知道是否有别的方法, 求得就是最短路径, 并且路径不带权(bfs)
const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
let m, n;
let start = []
let end = []
let k;
let kArr = [];
rl.on("line", (line) => {
    if (m === undefined) {
        [m, n] = line.trim().split(/\s+/).map(Number)
    } else if (start.length === 0) {
        start = line.trim().split(/\s+/).map(Number)
    } else if (end.length === 0) {
        end = line.trim().split(/\s+/).map(Number)
    } else if (k === undefined) {
        k = Number(line.trim())
        if (k === 0) {
            getResult(m, n, start, end, k, kArr)

            // clear
            m = n = k = undefined
            start.length = 0
            end.length = 0
            kArr.length = 0
        }
    } else if (k !== 0) {
        kArr.push(line.trim().split(/\s+/).map(Number))
        if (kArr.length === k) {
            getResult(m, n, start, end, k, kArr)

            // clear
            m = n = k = undefined
            start.length = 0
            end.length = 0
            kArr.length = 0
        }
    }

})

function getResult(m, n, start, end, k, kArr) {
    let dp = new Array(m).fill(null).map(_ => new Array(n).fill(false))
    if (k > 0) {
        for (const [a, b] of kArr) {
            dp[a][b] = true
        }
    }
    if (start[0] === end[0] && start[1] === end[1]) { // 起点和终点重合
        console.log('0 0')
        return 0
    }

    // bfs 计算最短距离
    let count = 0
    let pq = [start]
    let direction = [
        [-1, 0],
        [1, 0],
        [0, -1],
        [0, 1]
    ]
    let bfsDp = JSON.parse(JSON.stringify(dp))
    outer: while (pq.length) {
        let length = pq.length
        count++
        for (let i = 0; i < length; i++) {
            let [x, y] = pq.shift()
            bfsDp[x][y] = true
            for (const [addX, addY] of direction) {
                let newX = x + addX
                let newY = y + addY
                if (newX >= 0 && newX < m && newY >= 0 && newY < n && bfsDp[newX][newY] === false) {
                    pq.push([newX, newY])
                    if (newX === end[0] && newY === end[1]) {
                        break outer
                    }
                }
            }
        }

    }


    // dfs计算路线数量, 长度为count
    let ans = 0
    dp[start[0]][start[1]] = true
    dfs(start[0], start[1], 0, count)
    console.log(`${ans} ${count}`)


//dfs 加回溯

    function dfs(x, y, step, target) {
        if (x === end[0] && y === end[1] && step === target) {
            ans++
            return
        }
        if (step >= target) return

        for (const [addX, addY] of direction) {
            let newX = x + addX
            let newY = y + addY
            if (newX >= 0 && newX < m && newY >= 0 && newY < n && dp[newX][newY] === false) {
                dp[newX][newY] = true
                dfs(newX, newY, step + 1, target)
                dp[newX][newY] = false
            }
        }
    }
}

